/*********************************************************************************
  *FileName:  nsuc16xx_flash.h
  *Version:  V1.0
  *Date: 2023-04-19
**********************************************************************************/

#ifndef  __nsuc16xx_flash_H__
#define  __nsuc16xx_flash_H__

/***************************************Includes***********************************/
#include "nsuc16x0.h"


/***************************************Macros***********************************/
/* Flash lock key */
#define FLASH_UNLOCK_KEY0 0x76543210
#define FLASH_UNLOCK_KEY1 0xFEDCBA98
#define FLASH_UNLOCK_KEY2 0xF3E2D1C0
#define FLASH_UNLOCK_KEY3 0x0F1E2C3D

#define RAM_Flash_WritePage             ((uint32_t (*)(uint32_t page_address, uint32_t *data))0x01000139)
#define RAM_Flash_EraseSector           ((uint32_t (*)(uint32_t sec_address))0x01000091)
#define RAM_Flash_EraseFull             ((uint32_t (*)(uint32_t))0x01000001)
/***************************************Variables***********************************/



/***************************************Functions***********************************/
void Flash_Unlock(void);
uint32_t Flash_WritePage(uint32_t page_address, uint32_t *data);
uint32_t Flash_EraseSector(uint32_t sec_address);

#endif
/* [] END OF nsuc16xx_flash.h */
